<%@ language="vbscript"%>
<%
	Session("FormName")="F24"
%>
<!--#include file="..\..\CheckSession.inc"-->
<!--#include file="..\..\jvGrid.inc"-->
<%
	if  Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),1)="1" or Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),1)="1" or Session("IsAdmin") then
		sSQL="SELECT DISTINCT VTden.*"
		sSQL=sSQL+" FROM vanban_vuviec INNER JOIN VTden ON vanban_vuviec.mavanban = VTden.ID INNER JOIN Vuviec ON vanban_vuviec.mavuviec = Vuviec.Ma"
		sSQL=sSQL+" WHERE (((Vuviec.Ma) Like '"& Session("bMaVV") &"') AND ((vanban_vuviec.Loaivanban) Like '1') AND ((VTden.Trangthaiduyet)=1)) Order by ngayky DESC"
	else
		sSQL="SELECT Vuviec.Ma, VTden.*, Quyen.Macanbo, vanban_vuviec.Loaivanban, Quyen.Quyen, VTden.Trangthaiduyet"
		sSQL=sSQL+" FROM Quyen INNER JOIN ((vanban_vuviec INNER JOIN VTden ON vanban_vuviec.mavanban = VTden.ID) INNER JOIN Vuviec ON vanban_vuviec.mavuviec = Vuviec.Ma) ON Quyen.Mavanthu = VTden.ID"
		sSQL=sSQL+" WHERE (((Vuviec.Ma) Like '"& Session("bMaVV") &"') AND ((Quyen.Macanbo) Like '"& Session("bMaCB") &"') AND ((vanban_vuviec.Loaivanban) Like '1') AND ((Quyen.Quyen)<>'') AND ((VTden.Trangthaiduyet)=1)) Order by ngayky DESC"
	end if
	Set Rec=Server.CreateObject("ADODB.Recordset")
	Rec.CursorType=3
	Rec.CacheSize=5
	rec.Open ssql,Conn	
	%>
<script language=VBScript runat=server>
	Function SaveDate(vDate)
		dim bvitri1
		dim bvitri2
	   vDate=trim(cstr(vDate))
	   bvitri1=instr(1,vDate,"/")
	   bMonth=left(vDate,bvitri1-1)
	   bvitri2=instr(bvitri1+1,vDate,"/")
	   Dim Temp
	   Temp=right(vDate,len(vDate)-bvitri1)
	   bDay=left(Temp,bvitri2-bvitri1-1)
	   bYear=right(vDate,len(vDate)-bvitri2)
       SaveDate=bDay+"/"+bMonth+"/"+bYear
	End Function
	' H&#224;m &#273;&#7883;nh d&#7841;ng l&#7841;i ng&#224;y M/D/Y-> D/M/Y
	Function FormatDate(vDate)
	   If Not IsNull(vDate) Then
	        vM = Right("0" & Month(vDate), 2)
	        vD = Right("0" & Day(vDate), 2)
	        vY = Right("19" & Year(vDate), 4)
	        FormatDate = vD & "/" & vM & "/" & vY
	   End If
	End Function
	Function ModiString(mess_s)
		message = Replace("" & mess_s,"'", "''")
		ModiString=message
	End function
</script>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Gi</title>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function Row_Dblclick(bTentep) {
	window.frm.target="new";
	window.frm.action="../Xemnoidung.asp?vuviec_vanthu=den&tentep="+bTentep;
	window.frm.submit();
}

//-->
</SCRIPT>
</head>
<body topmargin="0" leftmargin="0" >
<form method="POST" name=frm>
 <table  border="0" width="100%" style="border-style: solid">
  <tr>
    <td width="100%" colspan="4" bgcolor="#173584" ALIGN="CENTER"><FONT COLOR="#FFFFFF" FACE="Times new roman" SIZE="3">Công
      v&#259;n &#273;&#7871;n</font></td>     		
  </tr> 
  <tr bgcolor="#bdd5d0">
    <td width="15%" align="center"><font face="Arial" size="2">Mã</font></td>
    <td width="45%" align="center"><font face="Arial" size="2">Tên</font></td>
    <td width="15%" align="center"><font face="Arial" size="2">Ng&#224;y k&#253;</font></td>
    <td width="25%" align="center"><font face="Arial" size="2">Ng&#432;&#7901;i k&#253;</font></td>
  </tr>
  <%	
	If Not Rec.EOF Then
		nRecCount = Rec.RecordCount
		Rec.PageSize = 20
		nPageCount = Rec.PageCount
		If nPage < 1 then
			nPage = 1			
		End If
		if nPage > nPageCount Then
			nPage=nPageCount
		end if
		TotalN=rec.recordcount
		%>
		<input type="hidden" name=TotalMax value=<%=TotalN%>>
	<%
		STT=1
		rec.AbsolutePage=nPage
		cnt=1
		do while not Rec.EOF
			if (cnt/2=int(cnt/2)) then
				color="#eeeecc"
			else
				color="#F8F9D9"
			end if
			sSQL="Select * from vanban_noidung where mavanthu like '"& Rec("ID") &"' and Loaivanthu like '1' order by Sothutu"
			set RecLaytentep=server.CreateObject("ADODB.Recordset")
			RecLaytentep.CursorType=3
			RecLaytentep.CacheSize=5
			RecLaytentep.Open sSQL,Conn
			if RecLaytentep.RecordCount then
				Tentep=RecLaytentep("Tentep")
			end if
			RecLaytentep.Close
			set RecLaytentep=nothing
%>
			<tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>" 
 onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
			  <input type="hidden" name=Ma<%=STT%> value=<%=Rec("ID")%>>         
  			  <input type="hidden" name=Ma<%=STT%> value=<%=Rec("ID")%>>  
			  <td width="15%"><font face="Arial" size="2"><a style="cursor:hand;color:blue;text-decoration: none" href="../Xemnoidung.asp?vuviec_vanthu=den&LoaiVT=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngaynhan"))%>" target="_blank"><%=Rec("Sogoc")%></a></font></td>
			  <td width="45%"><font face=Arial size="2"><a style="cursor:hand;color:blue;text-decoration: none" href="../Xemnoidung.asp?vuviec_vanthu=den&LoaiVT=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngaynhan"))%>" target="_blank"><%=Rec("trichyeu")%></a></font></td>
			  <td width="15%" align=center><font face=Arial size="2"><a style="cursor:hand;color:blue;text-decoration: none" href="../Xemnoidung.asp?vuviec_vanthu=den&LoaiVT=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngaynhan"))%>" target="_blank"><%=FormatDate(Rec("ngayky"))%></a></font></td>
			  <td width="25%"><font face=Arial size="2"><a style="cursor:hand;color:blue;text-decoration: none" href="../Xemnoidung.asp?vuviec_vanthu=den&LoaiVT=1&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngaynhan"))%>" target="_blank"><%=Rec("Nguoiky")%></a></font></td>
			</tr>
		<%
			if  Session("VanBan")="" then
				Session("VanBan")="-" & Rec("ID") 
			else
				Session("VanBan")=Session("VanBan") & "-" & Rec("ID") 
			end if
		%>
<%			STT=STT+1
			Rec.MoveNext
			cnt=cnt+1
		loop
		Session("VanBan")=Session("VanBan") & "-"
	end if
	rec.Close
	set rec=nothing
%>  			
</table>
</form>
</body>
</html>
<%
	Conn.Close
	Set Conn=nothing
%>